# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgname=libva
pkgver=2.20.0
pkgrel=1
pkgdesc='Video Acceleration (VA) API for Linux'
arch=(loong64 x86_64)
url=https://01.org/linuxmedia/vaapi
license=(MIT)
depends=(
  libdrm
  libgl
  libx11
  libxext
  libxfixes
  wayland
)
makedepends=(
  git
  libglvnd
  mesa
  meson
)
optdepends=(
  'intel-media-driver: backend for Intel GPUs (>= Broadwell)'
  'libva-intel-driver: backend for Intel GPUs (<= Haswell)'
  'libva-mesa-driver: backend for AMD and NVIDIA GPUs'
)
provides=(
  libva-drm.so
  libva-glx.so
  libva-wayland.so
  libva-x11.so
  libva.so
)
backup=(etc/libva.conf)
_tag=907b2b5405ca1091b4360bf35060e143bd704b62
source=(git+https://github.com/intel/libva.git#tag=${_tag})
b2sums=('SKIP')

pkgver() {
  cd libva
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

build() {
  CFLAGS+=" -DENABLE_VA_MESSAGING" # Option missing
  arch-meson libva build
  meson compile -C build
}

package() {
  meson install -C build --destdir "${pkgdir}"
  install -Dm 644 libva/COPYING -t "${pkgdir}"/usr/share/licenses/${pkgname}
  install -Dm 644 /dev/stdin "${pkgdir}"/etc/libva.conf <<END
LIBVA_MESSAGING_LEVEL=1
END
}

# vim:set sw=2 sts=-1 et:
